<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="author" content="Patrick T. Komiske III" /><link rel="canonical" href="https://thaler-lab.github.io/Wasserstein/installation/" />
      <link rel="shortcut icon" href="../img/favicon.ico" />
    <title>Installation - Wasserstein</title>
    <link rel="stylesheet" href="../css/theme.css" />
    <link rel="stylesheet" href="../css/theme_extra.css" />
        <link href="../css/eftheme.css" rel="stylesheet" />
        <link href="../css/pygmentize_friendly.css" rel="stylesheet" />

      <script>
        // Current page data
        var mkdocs_page_name = "Installation";
        var mkdocs_page_input_path = "installation.md";
        var mkdocs_page_url = "/Wasserstein/installation/";
      </script>

    <script src="../js/jquery-3.6.0.min.js" defer></script>
    <!--[if lt IE 9]>
      <script src="../js/html5shiv.min.js"></script>
    <![endif]-->
      <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-122962541-3', 'Wasserstein');
        ga('send', 'pageview');
      </script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
    <div class="wy-side-scroll">
      <div class="wy-side-nav-search">
  <a href="..">
    <div class="eflogo">
      <img src="../img/eflogowhite.png"  class="eflogo-img"> Wasserstein
    </div>
  </a><div role="search">
  <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
      <input type="text" name="q" placeholder="Search docs" title="Type search term here" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
                <li class="toctree-l1"><a class="reference internal" href="..">Home</a>
                </li>
              </ul>
              <p class="caption"><span class="caption-text">Getting Started</span></p>
              <ul class="current">
                  <li class="toctree-l1 current"><a class="reference internal current" href="./">Installation</a>
    <ul class="current">
    <li class="toctree-l2"><a class="reference internal" href="#python">Python</a>
        <ul>
    <li class="toctree-l3"><a class="reference internal" href="#install-via-pip">Install via pip</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#install-from-python-source">Install from Python source</a>
    </li>
        </ul>
    </li>
    <li class="toctree-l2"><a class="reference internal" href="#c">C++</a>
    </li>
    </ul>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../demos/">Python Demos</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../examples/">C++ Examples</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../faqs/">FAQs</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../releases/">Release Notes</a>
                  </li>
              </ul>
              <p class="caption"><span class="caption-text">Documentation</span></p>
              <ul>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/emd/">EMD</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/emds/">PairwiseEMD</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/externalemdhandler/">External EMD Handlers</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/event/">Events</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/pairwisedistance/">Pairwise Distance</a>
                  </li>
                  <li class="toctree-l1"><a class="reference internal" href="../docs/utils/">Utils</a>
                  </li>
              </ul>
      </div>
    </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      <nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="..">Wasserstein</a>

      </nav>
      <div class="wy-nav-content">
        <div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href=".." class="icon icon-home" alt="Docs"></a> &raquo;</li>
          <li>Getting Started &raquo;</li><li>Installation</li>
    <li class="wy-breadcrumbs-aside">
    </li>
  </ul>
  <hr/>
</div>

          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div class="section" itemprop="articleBody">

                <h1 id="installation">Installation</h1>
<p>The Wasserstein package can be used as a header-only C++ template library or as a Python package that wraps the C++ code.</p>
<h2 id="python">Python</h2>
<h3 id="install-via-pip">Install via <code>pip</code></h3>
<p>Precompiled Python wheels are available for Linux, maxOS, and Windows via PyPI. The only strict dependency is NumPy, though Wurlitzer is also installed in order to redirect standard output into Jupyter notebooks in the demos. Simply run the following in a terminal to install Wasserstein:</p>
<div class="codehilite"><pre><span></span><code><span class="n">pip3</span> <span class="n">install</span> <span class="n">wasserstein</span>
</code></pre></div>

<h3 id="install-from-python-source">Install from Python source</h3>
<p>The only reason to bother with the source code when using Wasserstein in Python is if one wants to develop some feature in the package. The Wasserstein source code can be obtained from <a href="https://github.com/thaler-lab/Wasserstein">GitHub</a>. Running <code>python3 setup.py swig</code> (which requires the <code>swig</code> binary to be available on the path) will regenerate the Python wrapper code. Running <code>python3 setup.py build_ext --inplace</code> will compile the library, and <code>pip3 install -e .</code> will install a development version pointing to the current directory.</p>
<h2 id="c">C++</h2>
<p>The Wasserstein source code can be obtained from <a href="https://github.com/thaler-lab/Wasserstein">GitHub</a>. Since the library is header-only, no compilation is required to install it. The provided <code>install_wasserstein.sh</code> script can be used (on a UNIX-like system, at least) to move the requisite header files to an appropriate location such as <code>/usr/local/include</code>. If your system does not have the <a href="https://www.boost.org/">Boost libraries</a> (version 1.70.0 or newer is required to access the histogram package) available, set the second argument to <code>true</code> in order to use the provided <a href="https://www.boost.org/doc/libs/1_74_0/libs/histogram/doc/html/index.html">Boost Histogram</a> header files.</p>
<p>Try the following in order to move the Wasserstein header files to an installed location, in this case <code>/usr/local/include</code>:</p>
<div class="codehilite"><pre><span></span><code>git clone https://github.com/thaler-lab/Wasserstein
<span class="nb">cd</span> Wasserstein
chmod +x install_wasserstein.sh
./install_wasserstein /usr/local <span class="nb">false</span>
</code></pre></div>

            </div>
          </div><footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
        <a href=".." class="btn btn-neutral float-left" title="Home"><span class="icon icon-circle-arrow-left"></span> Previous</a>
        <a href="../demos/" class="btn btn-neutral float-right" title="Python Demos">Next <span class="icon icon-circle-arrow-right"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
      <p>Copyright (C) 2019-2021 Patrick T. Komiske III</p>
  </div>

  Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>

        </div>
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" aria-label="Versions">
  <span class="rst-current-version" data-toggle="rst-current-version">

        <span>
          <a href="https://github.com/thaler-lab/Wasserstein/" class="fa fa-github" style="color: #fcfcfc"> GitHub</a>
        </span>


      <span><a href=".." style="color: #fcfcfc">&laquo; Previous</a></span>


      <span><a href="../demos/" style="color: #fcfcfc">Next &raquo;</a></span>

  </span>
</div>
    <script>var base_url = '..';</script>
    <script src="../js/theme_extra.js" defer></script>
    <script src="../js/theme.js" defer></script>
      <script src="../js/extra.js" defer></script>
      <script src="https://polyfill.io/v3/polyfill.min.js?features=es6" defer></script>
      <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" defer></script>
      <script src="../search/main.js" defer></script>
    <script defer>
        window.onload = function () {
            SphinxRtdTheme.Navigation.enable(true);
        };
    </script>

</body>
</html>
